import { equalsIgnoreCase } from "../../equalsIgnoreCase";
import { isEmpty } from "../../isEmpty";
import { isString } from "../../isString";

function methodHelper(value: string, methodName: string): boolean;
function methodHelper(value: Request, methodName: string): boolean;
function methodHelper(value: string | Request, methodName: string): boolean {
  if (isEmpty(value)) return false;

  if (isString(value)) return equalsIgnoreCase(value, methodName);
  else return equalsIgnoreCase(value.method, methodName);
}

export { methodHelper };
